//
//  HW02_HelloPolyViewController.m
//  HW02_HelloPoly
//
//  Created by 李 淑鳳 on 2011/7/29.
//  Copyright 2011年 頤德國際股份有限公司. All rights reserved.
//

#import "HW02_HelloPolyViewController.h"

@implementation HW02_HelloPolyViewController

- (id)init
{
    if (self = [super init])
    {
        m_NumOfSides = 0;
    }
    return self;
}

- (void)dealloc
{
    [m_NumOfSidesLabel release];
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
}
*/

- (void)viewDidUnload
{
    [m_NumOfSidesLabel release];
    m_NumOfSidesLabel = nil;
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (IBAction)increase {
    if (m_NumOfSides < 20)
    {
        m_NumOfSides++;
        m_NumOfSidesLabel.text = [NSString stringWithFormat: @"Number of Sides: %2d", m_NumOfSides];
    }
}

- (IBAction)decrease {
    if (m_NumOfSides > 0)
    {
        m_NumOfSides--;
        m_NumOfSidesLabel.text = [NSString stringWithFormat: @"Number of Sides: %2d", m_NumOfSides];
    }
}
@end
